/**   
 * @Title: LotteryInfoListDetailAct.java 
 * @Package com.esun.rabbit2.viewer.mainact.lotteryinfoact 
 * @Description: (开奖信息详情Activity) 
 * @Author Billy qigs@500wan.com   
 * @Date 2011-6-20 上午10:34:08  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.viewer.mainact.lotteryinfoact;

import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.TextView;

import com.esun.config.Config;
import com.esun.config.Key;
import com.esun.network.ConnectionChangeReceiver;
import com.esun.ui.R;
import com.esun.util.ViewerUtil;
import com.esun.util.log.EDebug;

/**
 * @ClassName: LotteryInfoDetailAct
 * @Description: (开奖信息详情Activity)
 * @author Billy qigs@500wan.com
 * @date 2011-6-7 上午09:51:04
 * 
 */
public class LotteryInfoDetailAct extends Activity {
	private ImageButton btnBack;
	private WebView webViewDetail;
	private ProgressDialog progressDialog;
	private String strExpect;
	private String strLotid;
	private String strLotName;
	private String strURL = "";

	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		super.setContentView(R.layout.lotteryinfodetail_act);

		initUI();
		EDebug.o(this, strURL + strExpect);
		webViewDetail.loadUrl(strURL + strExpect);
	}

	public void initUI() {
		Bundle bundle = this.getIntent().getExtras();
		strExpect = bundle.getString(Key.KEY_EXPECT);
		strLotid = bundle.getString(Key.KEY_LOTID);
		EDebug.o(this, "lot id = " + strLotid);
		if (strLotid.equals(Config.SHUANGSEQIU)) {
			strLotName = "双色球第";
			strURL = Config.STRSHUANGSEQIUURL;
		} else if (strLotid.equals(Config.DALETOU)) {
			strLotName = "大乐透第";
			strURL = Config.STRDALETOUURL;
		} else if (strLotid.equals(Config.FUCAI3D)) {
			strLotName = "福彩3D第";
			strURL = Config.STRFUCAISANDIURL;
		} else if (strLotid.equals(Config.SHENGFUCAI)) {
			strLotName = "足球胜负/任九第";
			strURL = Config.STRSHENGFUURL;
		} else if (strLotid.equals(Config.RENXUANJIU)) {
			strLotid = "足球胜负/任九第";
			strURL = Config.STRSHENGFUURL;
		}

		progressDialog = ViewerUtil.showProgressDialog(LotteryInfoDetailAct.this, getResources().getString(R.string.loading_text));
		progressDialog.show();

		TextView tvTitle = (TextView) findViewById(R.id.lotteryinfodetailact_tv_title);
		tvTitle.setText(strLotName + strExpect + "期开奖详情");

		webViewDetail = (WebView) findViewById(R.id.lotteryinfodetailact_webview_detail);
		webViewDetail.setWebViewClient(new WebViewClient() {

			@Override
			public void onPageFinished(WebView view, String url) {
				// TODO Auto-generated method stub
				super.onPageFinished(view, url);
				progressDialog.cancel();
			}

			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon) {
				// TODO Auto-generated method stub
				super.onPageStarted(view, url, favicon);
			}

		});

		btnBack = (ImageButton) findViewById(R.id.lotteryinfodetailact_btn_back);
		btnBack.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				LotteryInfoDetailAct.this.finish();
			}
		});
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		this.unregisterReceiver(ConnectionChangeReceiver.getConnectionChangeReceiver());
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		this.registerReceiver(ConnectionChangeReceiver.getConnectionChangeReceiver(), ConnectionChangeReceiver.getIntentFilter());
	}

}
